<%@page import="com.dxl.dao.common.context.SessionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%>
<%@ include file="/WEB-INF/view/common/loginCheck.jspf" %>
<div class="easyui-panel" data-options="fit:true,footer:'#sysPropEditBtns'" style="padding:10px;">
    <form id="sysPropEditForm" method="post">
		 <table style="width:100%">
             <tr>
                 <td>键:</td>
                 <td>
                	<input type="hidden" name="id" value="${entity.id}" />
                 	<input class="easyui-textbox" style="width:200px;" type="text" name="propKey" value="${entity.propKey}" data-options="required:true" />
                 </td>
             </tr>
             <tr>
                 <td>值:</td>
                 <td>
                 	<input class="easyui-textbox" style="width:250px;" type="text" name="propValue" value="${entity.propValue}" data-options="required:true" />
                 </td>
             </tr>
             <tr>
                 <td>备注:</td>
                 <td>
                 	<input class="easyui-textbox" style="width:250px;" type="text" name="remark" value="${entity.remark}" />
                 </td>
             </tr>
             <tr>
                 <td>排序值:</td>
                 <td>
                 	<input class="easyui-textbox" style="width:250px;" type="text" name="orderValue" value="${entity.orderValue}" />
                 </td>
             </tr>
             <tr>
                 <td>状态:</td>
                 <td>
                 	<select name="state">
                 		<option value="1" <c:if test="${entity.state == 1}">selected="selected"</c:if>>启用</option>
                 		<option value="0" <c:if test="${entity.state == 0}">selected="selected"</c:if>>草稿</option>
                 		<option value="-1" <c:if test="${entity.state == -1}">selected="selected"</c:if>>停用</option>
                 		<option value="-2" <c:if test="${entity.state == -2}">selected="selected"</c:if>>删除</option>
                 	</select>
                 </td>
             </tr>
         </table>
	</form>
</div>
<t:permission codes="SYSPROP-VIEW,SYSPROP-MODIFY">
<div id="sysPropEditBtns" style="text-align:right;padding:2px;">
	<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="saveSysProp();">保存</a>
</div>
</t:permission>

<script type="text/javascript">
	$(function () {
		$('#sysPropEditForm').form({
		    url:'${ROOT}/sysprop/save?_rt=' + new Date().getTime(),
		    ajax: true,
		    onSubmit: function() {
		    	return $(this).form('enableValidation').form('validate');
		    },
		    success:function(data) {
		    	var json = eval('(' + data + ')');
				if (json.success) {
					APP.message('保存成功');
		        	$('#sysPropEditDlg').dialog('close');
		        	$('#sysPropDataList').datagrid('reload');
					$('#sysPropDataList').datagrid('clearSelections');
		        	$('#sysPropDataList').datagrid('clearChecked');
		        } else {
		        	 APP.error(json.msg);
		        }
		    }
		});
	});
	
	function saveSysProp() {
		$('#sysPropEditForm').submit();
	}
	
	function closeSysPropEditDlg() {
		$('#sysPropEditDlg').dialog('close');
	}
</script>